Conversation
If called callback returns false, ArrayEachLimited will stop processing.
|
In my opinion, it should return an |
|
I thought about error, but in my opinion, error need to return when something went wrong. In this case we just want to tell that no need to iterate more. |
|
True, but |
|
Sounds good. Waiting for Leonid vote |
|
So, Leonid, what do you think about it? |
|
I think I would prefer to return |
|
Currently you can early exit in |
I'm not sure of the name, but just wrote implementation of ArrayEach with ability to stop processing array when required value found. To keep the backward compatibility I create new method ArrayEachLimited and ArrayEach uses it internally.
So callback function receives one extra argument – index of element in array and should return bool. If called callback returns false, ArrayEachLimited will stop processing.
What do you think?